#include <stdio.h>
struct student{
	char xh[100];
	char name[10];
	double grade;
};
int main()
{
	int n;
	double t,sum=0;
	scanf("%d",&n);
	struct student p[n];
	for(int i=0;i<n;i++){
		scanf("%s%s%lf",&p[i].xh,&p[i].name,&p[i].grade);
	    sum+=p[i].grade;
}
	t=1.0/n*sum;
	printf("%.2lf\n",t);
	for(int i=0;i<n;i++){
		if(p[i].grade<t){
		printf("%s %s\n",p[i].name,p[i].xh);
	}
	}
	
	return 0;
}
